<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:insert="~{include :: header('审核操作')}" />
    <link rel="stylesheet" href="/static/libs/layui-v2.6.8/css/layui.css" media="all">
    <style>
        .contentClass{
            cursor:pointer;margin:5px;
        }
        .form-text{
            margin-left: 15px;
        }
    </style>
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
    <form id="form-document-approval" class="form-horizontal" th:object="${document}">
        <br>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">标题:</label>
            <span class="col-sm-8 col-form-label" th:text="*{title}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">用户:</label>
            <span class="col-sm-3 col-form-label" th:text="${document.userName}+'('+${document.userId}+')'"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">通用评语:</label>
                <div class="col-sm-9">
                    <div class="layui-tab layui-tab-card">
                        <ul class="layui-tab-title" >
                            <li class="layui-this">通用评语</li>
                        </ul>
                        <div class="layui-tab-content" style="height: 160px;overflow: auto;" th:if="${status==1}">
                            <div  class="layui-tab-item layui-show" >
                                <span class="layui-badge-rim contentClass">难得的好资料!非常好!感谢你的无私奉献!</span>
                                <span class="layui-badge-rim contentClass">总结较完整，值得一读。</span>
                                <span class="layui-badge-rim contentClass">扫描资料，有参考价值。</span>
                                <span class="layui-badge-rim contentClass">录象资料，内容很丰富、难得！</span>
                                <span class="layui-badge-rim contentClass">形象直观，上课前看一遍，效果更好。</span>
                                <span class="layui-badge-rim contentClass">谢谢您的收集整理，欢迎您整理更多的资料上传上来。</span>
                            </div>
                        </div>
                        <div class="layui-tab-content" style="height: 160px;overflow: auto;" th:if="${status == -1}">
                            <div  class="layui-tab-item layui-show" >
                                <span class="layui-badge-rim contentClass">您上传的这份资料与编号（）的资料重复了，所以作退稿处理。</span>
                                <span class="layui-badge-rim contentClass">您上传的这个资料与编号（）的资料内容雷同，只是标题不同。</span>
                                <span class="layui-badge-rim contentClass">您所上传的资料内容实用性不强，参考价值不大，感谢您的上传，暂时作退稿处理。</span>
                                <span class="layui-badge-rim contentClass">上传栏目或分类错误了，请更正后再重新上传。</span>
                                <span class="layui-badge-rim contentClass">论文资料若非原创涉及侵权，所以原创论文请注明原创，非原创论文请注明引用自何地何人，谢谢！</span>
                                <span class="layui-badge-rim contentClass">您所上传的这个试题是假的试题，请不要将过时的陈旧资料换个新名称，恶意上传是要承担责任的。</span>
                                <span class="layui-badge-rim contentClass">您上传的资料的名称以及简介,与下载后打开看到的资料内容无关，这样的将会被视作恶意上传处理！</span>
                            </div>
                        </div>
                    </div>
                </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">意见/评语:</label>
            <div class="col-sm-9 col-form-label">
                <textarea id="comment" name="comment" style="min-height: 100px" placeholder="请填写审核意见或评语"  class="form-control"></textarea>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label is-required text-sm-right">售价</label>
            <div class="col-sm-2">
                <input name="price" id="price" class="form-control" th:value="*{price/100}" type="text" required>
            </div>
            <span class="form-text text-red" onclick="$('#price').val(1)">1元</span>
            <span class="form-text text-red" onclick="$('#price').val(3)">3元</span>
            <span class="form-text text-red" onclick="$('#price').val(5)">5元</span>
            <span class="form-text text-red" onclick="$('#price').val(10)">10元</span>
        </div>
        <div class="row">
            <label class="col-sm-2"></label>
            <div class="col-sm-10">
                <input id="id" type="hidden" name="id" th:value="*{id}">
                <input id="status" type="hidden" name="status" th:value="${status}">
                <button type="button" class="btn btn-primary" onclick="submitDocument()"><i class="fa fa-check"></i><span  th:text="${status == 1?' 通 过':' 驳 回'}"></span></button>&nbsp;
                <button type="button" class="btn btn-danger" onclick="parent.layer.closeAll()"><i class="fa fa-reply-all"></i> 关 闭 </button>
            </div>
        </div>
    </form>
</div>
<th:block th:insert="~{include :: footer}" />
<script src="/static/libs/layui-v2.6.8/layui.js" charset="utf-8"></script>
<script>
    var prefix = "/document";

    $('.contentClass').on('click',function(){
        $('#comment').val($(this).text());
    });

    //修改保存
    function submitDocument() {
        if ($('#comment').val().length < 5) {
            return layer.msg('请输入评语，且必需大于3个字符！', {icon: 2});
        }
        $.modal.loading();
        var data = $("#form-document-approval").serializeArray();
        $.post(prefix + "/approval.json", data, function (result) {
            if (result.code === 0) {
                $.modal.msgSuccess(result.msg)
                setTimeout(function () {
                    $.modal.close();
                    parent.location.reload()
                },1000)
            } else {
                $.modal.msgError(result.msg);
            }
        });
    }
</script>
</body>
</html>